import QtQuick 2.6
import Qt.labs.controls 1.0
import QtQuick.Layouts 1.1
import "../template" as Tm

Tm.Navigator {
    id: nav
    title: "积分"


    ColumnLayout {
        anchors.fill: parent
        anchors.margins: iWIDTH

        Frame {
            Layout.fillWidth: true
            Layout.preferredHeight: iHEIGHT * 2
            Label {
                text: "可用积分：<font color=\"darkred\">" +  "100</font>"
                anchors.verticalCenter: parent.verticalCenter
            } 
        }

        ListView {
            id: view
            Layout.fillHeight: true
            Layout.fillWidth: true

            ButtonGroup {id: group}
            header: Item {
                width: view.width
                height: iHEIGHT
                Label {
                    text: "收支名细"
                    anchors.centerIn: parent
                }

                Rectangle {
                    color: "gainsboro"
                    width: parent.width * 0.6
                    anchors.horizontalCenter: parent.horizontalCenter
                    height: 1
                    anchors.bottom: parent.bottom
                }
            }
            model: ListModel {
                ListElement {
                    description: "京东小钱包：15638682936"
                    point: "+100"
                    time: "2018-11-30  15:34:34"
                }
                ListElement {
                    description: "京东小钱包：15638682936"
                    point: "-100"
                    time: "2018-11-30  15:34:34"
                }
            }

            delegate:  Rectangle {
                width: view.width
                height: iHEIGHT * 2

                RowLayout {
                    anchors.fill: parent
                    anchors.margins: iWIDTH

                    ColumnLayout {
                        spacing: iHEIGHT * 0.5
                        Label {
                            text: model.description
                        }
                        Label {
                            text: "时间：" + model.time
                        }
                    }
                        Label {
                            text: model.point
                        }

                }
                Rectangle {
                    color: "gainsboro"
                    width: parent.width
                    height: 1
                    anchors.bottom: parent.bottom

                    visible: index != view.count - 1
                }
            }
        }
    }
}
